package com.lwlk.zdk.controller.Fence;

import com.lwlk.zdk.enums.RetCode;
import com.lwlk.zdk.mapper.pw.pwFenceMapper;
import com.lwlk.zdk.model.pw.pwFence;
import com.lwlk.zdk.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping(value = "/fence")
public class FenceController {

    @Autowired
    pwFenceMapper pwFenceMapper;


    //==========设置电子围栏============
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Response add(pwFence pwFence){
        Response response=new Response();
        int i=pwFenceMapper.insertSelective(pwFence);
        Map map=new HashMap();
        map.put("fenceId",i);
        map.put("geom",pwFence.getGeom());
        map.put("radius",pwFence.getRadius());
        map.put("fenceType",pwFence.getFenceType());
        map.put("vehicleIds",pwFence.getVehicleIds());
        response.setData(i);
        response.setCode(RetCode.SUCCESS);
        response.setMsg("执行成功");
        return response;
    }


}
